using Godot;
using System;

public partial class Vignette : CanvasLayer
{
	GameEvents gameEvents;//自动加载文件
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		gameEvents = GetNode<GameEvents>("/root/GameEvents");
		gameEvents.PlayerDamaged += OnPlayerDamaged;
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}

	public void OnPlayerDamaged(){
		GetNode<AnimationPlayer>("AnimationPlayer").Play("hit");
	}

    public override void _ExitTree()
    {
		gameEvents.PlayerDamaged -= OnPlayerDamaged;
        base._ExitTree();
    }
}
